package com.ming.javaweb.service.impl;

import com.ming.javaweb.beans.DTO.StudentDTO;
import com.ming.javaweb.beans.VO.StudentVO;
import com.ming.javaweb.beans.VO.TableVO;
import com.ming.javaweb.beans.entity.StudentDO;
import com.ming.javaweb.dao.StudentDao;
import com.ming.javaweb.dao.impl.StudentDaoImpl;
import com.ming.javaweb.service.StudentService;

import java.sql.SQLException;

public class StudentServiceImpl implements StudentService {

    private StudentDao studentDao= new StudentDaoImpl();

    @Override
    public Boolean addStudent(StudentDO studentDO) throws SQLException {
        return studentDao.addStudent(studentDO) ==1;
    }

    @Override
    public TableVO<StudentVO> queryStudentByPage(StudentDTO studentDTO) throws SQLException {
        return studentDao.queryStudentByPage(studentDTO);
    }

    @Override
    public StudentVO getStudentBYId(int studentId) throws SQLException {
        return studentDao.getStudentById(studentId);
    }

    @Override
    public Boolean updateStudent(StudentDO studentDO) throws SQLException {
        return studentDao.updateStudent(studentDO) == 1 ;
    }

    @Override
    public Boolean deleteById(int deleteId) throws SQLException {
        return studentDao.deleteById(deleteId) == 1;
    }
}
